home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Libraries / Internet Config 1.2 / Internet Config / Examples / Example / PExample.p < prev   
Encoding:
Text File  |  1995-09-11  |  1.5 KB  |  60 lines  |  [TEXT/CWIE]

  1. program PExample;
  2.  
  3.     uses
  4.         Types, Files, Packages, Aliases, 
  5.         ICTypes, ICKeys, ICAPI;
  6.  
  7.     var
  8.         inst: ICInstance;
  9.  
  10.     procedure DumpPrefs;
  11.         var
  12.             count: longint;
  13.             i: longint;
  14.             key: Str255;
  15.     begin
  16.         writeln('ICCountPref: ', ICCountPref(inst, count) : 1);
  17.         for i := 1 to count do begin
  18.             write('  ICGetIndPref: ', ICGetIndPref(inst, i, key) : 1, ' - ');
  19.             writeln(key);
  20.         end; (* for *)
  21.     end; (* DumpPrefs *)
  22.  
  23.     procedure TestPascal;
  24.         var
  25.             folder_spec: ICDirSpecArray;
  26.             email_address: Str255;
  27.             attr: longint;
  28.             size: longint;
  29.             seed: longint;
  30.             mappings: handle;
  31.             entry: ICMapEntry;
  32.     begin
  33.         writeln('ICStart: ', ICStart(inst, 'CREA') : 1);        (* tell it your application creator *)
  34.         folder_spec[0].vRefNum := -1;                                (* search for prefs in root of the system *)
  35.         folder_spec[0].dirID := 2;                                        (* volume, obviously you'd use other things *)
  36.         writeln('ICFindConfigFile: ', ICFindConfigFile(inst, 1, @folder_spec) : 1);
  37.     
  38.         writeln('ICBegin: ', ICBegin(inst, icReadWritePerm) : 1);
  39.         size := sizeof(email_address);
  40.         writeln('ICGetPref: ', ICGetPref(inst, kICEmail, attr, @email_address, size) : 1);
  41.         writeln('Your Email address is ', email_address);
  42.     
  43.         DumpPrefs;
  44.         writeln('ICEnd: ', ICEnd(inst) : 1);
  45.     
  46.         writeln('ICGetSeed: ', ICGetSeed(inst, seed) : 1, ' = ', seed : 1);
  47.         (* now monitor this seed to see if any preferences have changed *)
  48.     
  49.         writeln('ICStop: ', ICStop(inst));
  50.     end;
  51.     
  52.     procedure TestC; C; external;
  53.         
  54. begin
  55.     writeln('Testing Pascal');
  56.     TestPascal;
  57.     writeln;
  58.     writeln('Testing C');
  59.     TestC;
  60. end. (* PExample *)